package github.ziwukun.jsonql.orm;

import java.sql.Time;
import java.sql.Timestamp;
import java.util.Date;

import cn.hutool.core.date.DateUtil;

public class DefaultPropConverter implements PropConverter<Object>{
	public Object convert(Object originValue) {
		// 时间
		if(originValue instanceof Time) {
			return DateUtil.format((Time)originValue, "HH:mm:ss");
		}
		// 日期时间
		if(originValue instanceof Timestamp) {
			return DateUtil.format((Timestamp)originValue, "yyyy-MM-dd HH:mm:ss");
		}
		// 日期
		if(originValue instanceof Date) {
			return DateUtil.format((Date)originValue, "yyyy-MM-dd");
		}
		
		return originValue;
	}

}
